<%inherit file="/index.mako" />

<%def name="title()">Compagnie-Chrysalide - Contacts</%def>
<center>
<div style="width: 720px; color: white;">
	<div style="width: 360px; float:left;" align="left">
		
		<h4>Liste des contacts</h4>

		<h5>Direction Artistique</h5>
		<p>
		Célia Quadri
		Tel: 06 79 92 74 87
		Email:
		</p>
		
		
	</div>
	<div style="float: right; width: 350px;">
		<h4>Le théâtre</h4>
		<p>
		8 rue Delillle - 06000 Nice<br />
		Téléphone : 06.79.92.74.87
		</p>
	</div>
	<div style="clear: both;"></div>
	<hr />
</div>

</center>
 
<div style="color: white;" id="contact_form" align="center">
	<h4>Formulaire de contact:</h4>
	<table cellspacing="0" cellpadding="0" border="0" id="contact_form_table">
		<tbody>
			<tr>
				<td>Email :</td>
				<td><input style="width: 100%;" type="text" id="send_message_sender" name="sender" /></td>
			</tr>
			<tr>
				<td>Sujet :</td>
				<td><input style="width: 100%;" type="text" id="send_message_subject" name="subject" /></td>
			</tr>
			<tr>
				<td colspan="2">Message :</td>	
			</tr>
			<tr>
				<td colspan="2">
					<textarea id="send_message_content" style="width: 100%; height: 150px;" name="content"></textarea>
				<td>
			</tr>
			<tr><td colspan="2"><button type="button" id="button_send_message">Envoyer</td></button></tr>
		</tbody>
	</table>
</div>
<br />
<script type="text/javascript">
$(document).ready(function() {
	$('#button_send_message').click(function(){
		
		var sender_b = $('#send_message_sender').val();
		var subject_b = $('#send_message_subject').val();
		var content_b = $('#send_message_content').val();
		
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		if(!emailReg.test($('#send_message_sender').val()) || $('#send_message_sender').val() == "") {
			alert("Votre email n'est pas valide");
			return false;
		}
		if($('#send_message_subject').val() == "" || $('#send_message_content').val() == ""){
			alert("Tout les champs doivent etre remplit");
			return false;
		}
		loading_popup('show');
		$('#send_message_sender').val("");
		$('#send_message_subject').val("");
		$('#send_message_content').val("");
		$(this).attr("disabled","disabled");
		$.post("/contact/send_message", { 	sender: sender_b, 
											subject: subject_b, 
											content: content_b },
			function(data) {
				if(data == '1'){
					alert("Votre message a bien ete envoye");
					$('#button_send_message').removeAttr("disabled");
				}else{
					alert("Votre message n'a pas put etre envoye. Notre webmaster en sera avertit, veuillez reesayer plus tard, merci.");
				}
				loading_popup('hide');
		   });
	});
});
</script>